from 操作消息队列 import *

# 获取 connection 和 channel 对象
connection,channel = conn_rabbitmq_guian()

# 声明队列
channel.queue_declare(queue='prod_dzgs_equip_scada_msg',durable=True)

# 读取消息队列中的数据
method, properties, body = channel.basic_get(queue='prod_dzgs_equip_scada_msg')

# 处理消息
if method:
    print("Received message: %s" % body)
    # 确认消息已处理
    channel.basic_ack(method.delivery_tag)
else:
    print("No message in queue")

# 关闭连接
connection.close()
